import 'package:hive/hive.dart';

import '../models/user_company.dart';

class AppCompanyDtoAdapter extends TypeAdapter<AppCompanyDto> {
  @override
  final int typeId = 2;

  @override
  AppCompanyDto read(BinaryReader reader) {
    return AppCompanyDto(
      id: reader.read() as String?,
      gmtCreate: reader.read() as String?,
      gmtModified: reader.read() as String?,
      name: reader.read() as String?,
      userId: reader.read() as String?,
      taxCode: reader.read() as String?,
      nationalName: reader.read() as String?,
      nationalPwd: reader.read() as String?,
      taxPayerPhone: reader.read() as String?,
      status: reader.read() as String?,
      province: reader.read() as String?,
      city: reader.read() as String?,
      loginWay: reader.read() as String?,
      isDefault: reader.read() as String?,
    );
  }

  @override
  void write(BinaryWriter writer, AppCompanyDto obj) {
    writer.write(obj.id);
    writer.write(obj.gmtCreate);
    writer.write(obj.gmtModified);
    writer.write(obj.name);
    writer.write(obj.userId);
    writer.write(obj.taxCode);
    writer.write(obj.nationalName);
    writer.write(obj.nationalPwd);
    writer.write(obj.taxPayerPhone);
    writer.write(obj.status);
    writer.write(obj.province);
    writer.write(obj.city);
    writer.write(obj.loginWay);
    writer.write(obj.isDefault);
  }
}

